<template>
    <div class="app-container">
        <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
            <el-form-item label="订单号" prop="orderNo">
                <el-input v-model="queryParams.orderNo" placeholder="请输入订单号" clearable maxlength="20" show-word-limit
                  style="width: 250px;"  @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="手机号" prop="phone">
                <el-input v-model="queryParams.phone" placeholder="请输入手机号" clearable maxlength="11"
                    show-word-limit @keyup.enter.native="handleQuery" />
            </el-form-item>
               <el-form-item label="企业" prop="enterpriseName">
                <el-select v-model="queryParams.enterpriseName">
               <el-option v-for="item in enterpriseData" :key="item.id" :value="item.enterpriseName" :label="item.enterpriseName">

               </el-option>
                </el-select>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
            </el-form-item>
        </el-form>

        <el-row :gutter="10" class="mb8">
            <el-col :span="1.5">
                <el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport"
                    v-hasPermi="['film:ticketOrder:export']">导出</el-button>
            </el-col>
            <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
        </el-row>
        <el-table v-loading="loading" :data="configurationList" @selection-change="handleSelectionChange">
            <el-table-column type="selection" width="55" align="center" />
            <el-table-column label="序号" align="center" width="55" type="index" />
            <el-table-column label="企业名称" align="center" prop="enterpriseName" min-width="200"
                :show-overflow-tooltip="true" />
            <el-table-column label="订单编号" align="center" prop="orderNo" min-width="200" :show-overflow-tooltip="true" />
            <el-table-column label="手机号" align="center" prop="phone" min-width="150" :show-overflow-tooltip="true" />
            <el-table-column label="影片名称" align="center" prop="filmName" min-width="200"
                :show-overflow-tooltip="true" />
            <el-table-column label="影厅" align="center" prop="hallName" min-width="200" :show-overflow-tooltip="true" />
            <el-table-column label="座位名称" align="center" prop="seatNames" min-width="200"
                :show-overflow-tooltip="true" />
                 <el-table-column label="网售价格" align="center" prop="clientMarketAmount" min-width="200"
                :show-overflow-tooltip="true" /> 
            <el-table-column label="订单结算价格" align="center" prop="settleAmount" min-width="100"
                :show-overflow-tooltip="true" />
            <el-table-column label="开场时间" align="center" prop="showTime" min-width="180"
                :show-overflow-tooltip="true" />
            <el-table-column label="结束时间" align="center" prop="endTime" min-width="180" :show-overflow-tooltip="true" />
            <el-table-column label="微信支付价格（元）" align="center" prop="wxOrderAmount" min-width="150"
                :show-overflow-tooltip="true" />
            <el-table-column label="状态" align="center" prop="status" min-width="100" :show-overflow-tooltip="true">
            </el-table-column>
            <el-table-column label="影院名称" align="center" prop="cinemaName" min-width="200"
                :show-overflow-tooltip="true" />
            <el-table-column label="影院地址" align="center" prop="cinemaAddress" min-width="200"
                :show-overflow-tooltip="true" />
            <el-table-column label="城市名称" align="center" prop="cityName" min-width="100"
                :show-overflow-tooltip="true" />

        </el-table>

        <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
            :limit.sync="queryParams.pageSize" @pagination="getList" />
    </div>
</template>

<script>
import { enterpriseList1} from '@/api/film/member.js'
import { ticketOrder } from '@/api/film/order.js'
export default {
    name: "ticketOrder",
    data() {
        return {
             enterpriseData:[],
            // 遮罩层
            loading: true,
            // 选中数组q
            ids: [],
            // 非单个禁用
            single: true,
            // 非多个禁用
            multiple: true,
            // 显示搜索条件
            showSearch: true,
            // 总条数
            total: 0,
            // 配置维护表格数据
            configurationList: [],
            // 弹出层标题
            title: "",
            // 是否显示弹出层
            open: false,
            // 查询参数
            queryParams: {
                phone: undefined,
                pageNum: 1,
                pageSize: 10,
                orderNo: undefined
            },
            // 表单参数
            form: {},
        };
    },
    created() {
          enterpriseList1().then(res=>{
            this.enterpriseData   = res.rows
        })
        this.getList();
    },
    methods: {
        /** 导出按钮操作 */
        handleExport() {
            this.download('/film/ticketOrder/export', {
                ...this.queryParams,
                ids: this.ids
            }, `电影票订单_${new Date().getTime()}.xlsx`)
        },
        /** 查询配置维护列表 */
        getList() {
            this.loading = true;
            ticketOrder(this.queryParams).then(response => {
                this.configurationList = response.rows;
                this.total = response.total;
                this.loading = false;
            });
        },
        // 取消按钮
        cancel() {
            this.open = false;
            this.reset();
        },

        /** 搜索按钮操作 */
        handleQuery() {
            this.queryParams.pageNum = 1;
            this.getList();
        },
        /** 重置按钮操作 */
        resetQuery() {
            this.resetForm("queryForm");
            this.handleQuery();
        },
        // 多选框选中数据
        handleSelectionChange(selection) {
            this.ids = selection.map(item => item.id)
            this.single = selection.length !== 1
            this.multiple = !selection.length
        }
    }
};
</script>
